package fr.web325.servlet.client.cart;

import fr.web325.dao.ClientDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/shop/client/paySuccess")
public class PaySuccess extends HttpServlet {
    @Override
    // 设置订单支付状态
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String order_id = req.getParameter("order_id");
        try {
            if(new ClientDao().editOrderSuccess(order_id)){
                // 支付成功 跳转我的订单界面
                req.getRequestDispatcher("mine").forward(req,resp);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
